using System;
using System.Windows.Forms;

namespace BeiraBaga
{
    public partial class TeamBarCodesXtraForm : DevExpress.XtraEditors.XtraForm
    {
        #region Members

        private Controller _controller;

        #endregion

        #region Properties

        public string Product { get { return (string)productLookUpEdit.EditValue; } }

        public string Team { get { return (string)teamLookUpEdit.EditValue;  } }

        public Controller Controller { set { _controller = value; } }

        #endregion

        public TeamBarCodesXtraForm()
        {
            InitializeComponent();
        }

        #region Event Handlers

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            teamsViewBindingSource.DataSource = _controller.Teams;
            artigoBindingSource.DataSource = _controller.Products;
        }

        private void okSimpleButton_Click(object sender, EventArgs e)
        {
            if (productLookUpEdit.EditValue == null || teamLookUpEdit.EditValue == null)
            {
                MessageBox.Show("Deve seleccionar um artigo e uma equipa.");
                DialogResult = DialogResult.Cancel;
            }
        }

        #endregion
    }
}